package com.nt.mes_leader.base_adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.nt.mes_leader.bean.Cell;
import com.nt.mes_leader.bean.ColTitle;
import com.nt.mes_leader.bean.TipTitle;

import cn.zhouchaoyuan.excelpanel.BaseExcelPanelAdapter;

/**
 * Created by netuo020 on 2017/9/20.
 */

public abstract class BaseCustomAdapter extends BaseExcelPanelAdapter<TipTitle, ColTitle, Cell> {

    public BaseCustomAdapter(Context context) {
        super(context);
    }

    public BaseCustomAdapter(Context context, View.OnClickListener listenerLeft, View.OnClickListener listenerItem) {
        super(context);
    }

    //=========================================content's cell===========================================
    @Override
    public RecyclerView.ViewHolder onCreateCellViewHolder(ViewGroup parent, int viewType) {
        return null;
    }

    @Override
    public void onBindCellViewHolder(RecyclerView.ViewHolder holder, int verticalPosition, int horizontalPosition) {
        Cell cell = getMajorItem(verticalPosition, horizontalPosition);
        if (null == holder || !(holder instanceof CellHolder) || cell == null) {
            return;
        }
        CellHolder viewHolder = (CellHolder) holder;
//        viewHolder.textContentTitle.setTag(cell);
//        viewHolder.textContentTitle.setOnClickListener(blockListener);
//        viewHolder.textContentTitle.setText(cell.getContent());
//        Log.i(TAG, " content == " + cell.getContent());
    }

    static class CellHolder extends RecyclerView.ViewHolder {

//        public final TextView textContentTitle;

        public CellHolder(View itemView) {
            super(itemView);
//            textContentTitle = (TextView) itemView.findViewById(R.id.text_content_title);
        }
    }


    //=========================================top cell===========================================
    @Override
    public RecyclerView.ViewHolder onCreateTopViewHolder(ViewGroup parent, int viewType) {
//        View layout = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_report_top_ana, parent, false);
//        TopHolder topHolder = new TopHolder(layout);
//        return topHolder;
        return null;
    }

    @Override
    public void onBindTopViewHolder(RecyclerView.ViewHolder holder, int position) {
//        AnaTipTitle rowTitle = getTopItem(position);
//        if (null == holder || !(holder instanceof TopHolder) || rowTitle == null) {
//            return;
//        }
//        int visible = rowTitle.getHasVisible();
//        TopHolder viewHolder = (TopHolder) holder;
//        Log.e("CustomAnaAdapter", "AnaTipTitle == " + rowTitle.toString());
//        viewHolder.layoutTop.setVisibility(View.GONE);
//        viewHolder.layoutBottom.setVisibility(View.VISIBLE);
//        String topTitle = TextUtils.isEmpty(rowTitle.getTopTitle()) ? "" : rowTitle.getTopTitle() + "\n";
//        String title = topTitle + rowTitle.getTitle();
//        viewHolder.textTipTitle.setText(title);
    }

    static class TopHolder extends RecyclerView.ViewHolder {

//        public final TextView textTipTitle, textTop;
//        public final LinearLayout layoutTop, layoutBottom;
//        public final View view;
//
        public TopHolder(View itemView) {
            super(itemView);
//            layoutTop = (LinearLayout) itemView.findViewById(R.id.layout_top);
//            layoutBottom = (LinearLayout) itemView.findViewById(R.id.layout_bottom);
//            textTipTitle = (TextView) itemView.findViewById(R.id.text_title);
//            textTop = (TextView) itemView.findViewById(R.id.text_top);
//            view = (View) itemView.findViewById(R.id.view_line);
        }
    }

    //=========================================left cell===========================================
    @Override
    public RecyclerView.ViewHolder onCreateLeftViewHolder(ViewGroup parent, int viewType) {
//        View layout = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_left_title, parent, false);
//        LeftHolder leftHolder = new LeftHolder(layout);
//        return leftHolder;
        return null;
    }

    @Override
    public void onBindLeftViewHolder(RecyclerView.ViewHolder holder, int position) {
//        AnaColTitle colTitle = getLeftItem(position);
//        if (null == holder || !(holder instanceof LeftHolder) || colTitle == null) {
//            return;
//        }
//        LeftHolder viewHolder = (LeftHolder) holder;
//        viewHolder.textLeftTitle.setTag(colTitle);
//        viewHolder.textLeftTitle.setOnClickListener(leftListener);
//        viewHolder.textLeftTitle.setText(colTitle.getLeftTitle());
    }

    static class LeftHolder extends RecyclerView.ViewHolder {

//        public final TextView textLeftTitle;

        public LeftHolder(View itemView) {
            super(itemView);
//            textLeftTitle = (TextView) itemView.findViewById(R.id.text_left_title);
        }
    }

    //=========================================left-top cell===========================================
    @Override
    public View onCreateTopLeftView() {
//        View view = LayoutInflater.from(context).inflate(R.layout.item_tip_title, null);
//        TextView textView = (TextView) view.findViewById(R.id.text_top_title);
//        textView.setText("化验记录");
//        return view;
        return null;
    }
}
